using System;
using System.Drawing;
using System.Windows.Forms;

namespace GomokuGame
{
    /// <summary>
    /// 设置窗体初始化器
    /// </summary>
    public static class SettingsFormInitializer
    {
        /// <summary>
        /// 初始化游戏设置控件
        /// </summary>
        public static void InitializeGameSettingsControls(SettingsForm form)
        {
            // 棋盘大小
            form.labelBoardSize.Location = new Point(20, 20);
            form.labelBoardSize.Size = new Size(100, 20);
            form.labelBoardSize.Text = "棋盘大小:";
            
            form.numericBoardSize.Location = new Point(130, 18);
            form.numericBoardSize.Size = new Size(80, 20);
            form.numericBoardSize.Minimum = 15;
            form.numericBoardSize.Maximum = 19;
            form.numericBoardSize.Value = 15;
            
            // 音效设置
            form.checkBoxSoundEnabled.Location = new Point(20, 50);
            form.checkBoxSoundEnabled.Size = new Size(120, 20);
            form.checkBoxSoundEnabled.Text = "启用落子音效";
            
            form.labelSoundVolume.Location = new Point(20, 80);
            form.labelSoundVolume.Size = new Size(120, 20);
            form.labelSoundVolume.Text = "音效音量: 50%";
            
            form.trackBarSoundVolume.Location = new Point(150, 75);
            form.trackBarSoundVolume.Size = new Size(200, 30);
            form.trackBarSoundVolume.Minimum = 0;
            form.trackBarSoundVolume.Maximum = 100;
            form.trackBarSoundVolume.Value = 50;
            form.trackBarSoundVolume.TickFrequency = 10;
            form.trackBarSoundVolume.ValueChanged += form.trackBarSoundVolume_ValueChanged;
            
            // 背景音乐设置
            form.checkBoxBackgroundMusic.Location = new Point(20, 110);
            form.checkBoxBackgroundMusic.Size = new Size(120, 20);
            form.checkBoxBackgroundMusic.Text = "启用背景音乐";
            
            form.labelMusicVolume.Location = new Point(20, 140);
            form.labelMusicVolume.Size = new Size(120, 20);
            form.labelMusicVolume.Text = "音乐音量: 30%";
            
            form.trackBarMusicVolume.Location = new Point(150, 135);
            form.trackBarMusicVolume.Size = new Size(200, 30);
            form.trackBarMusicVolume.Minimum = 0;
            form.trackBarMusicVolume.Maximum = 100;
            form.trackBarMusicVolume.Value = 30;
            form.trackBarMusicVolume.TickFrequency = 10;
            form.trackBarMusicVolume.ValueChanged += form.trackBarMusicVolume_ValueChanged;
            
            // 主题设置
            form.labelTheme.Location = new Point(20, 170);
            form.labelTheme.Size = new Size(100, 20);
            form.labelTheme.Text = "界面主题:";
            
            form.comboBoxTheme.Location = new Point(130, 168);
            form.comboBoxTheme.Size = new Size(120, 20);
            form.comboBoxTheme.Items.AddRange(new object[] { "默认", "深色", "浅色", "经典" });
            form.comboBoxTheme.SelectedIndex = 0;
            
            // 悔棋设置
            form.labelMaxUndo.Location = new Point(20, 200);
            form.labelMaxUndo.Size = new Size(100, 20);
            form.labelMaxUndo.Text = "最大悔棋次数:";
            
            form.numericMaxUndo.Location = new Point(130, 198);
            form.numericMaxUndo.Size = new Size(80, 20);
            form.numericMaxUndo.Minimum = 1;
            form.numericMaxUndo.Maximum = 50;
            form.numericMaxUndo.Value = 10;
            
            // 自动保存设置
            form.checkBoxAutoSave.Location = new Point(20, 230);
            form.checkBoxAutoSave.Size = new Size(150, 20);
            form.checkBoxAutoSave.Text = "自动保存游戏记录";
            
            form.labelKeepRecords.Location = new Point(20, 260);
            form.labelKeepRecords.Size = new Size(150, 20);
            form.labelKeepRecords.Text = "保留记录天数:";
            
            form.numericKeepRecords.Location = new Point(180, 258);
            form.numericKeepRecords.Size = new Size(80, 20);
            form.numericKeepRecords.Minimum = 1;
            form.numericKeepRecords.Maximum = 365;
            form.numericKeepRecords.Value = 30;
        }

        /// <summary>
        /// 初始化AI设置控件
        /// </summary>
        public static void InitializeAISettingsControls(SettingsForm form)
        {
            // 默认AI难度
            form.labelDefaultAI.Location = new Point(20, 20);
            form.labelDefaultAI.Size = new Size(100, 20);
            form.labelDefaultAI.Text = "默认AI难度:";
            
            form.comboBoxDefaultAI.Location = new Point(130, 18);
            form.comboBoxDefaultAI.Size = new Size(120, 20);
            form.comboBoxDefaultAI.Items.AddRange(new object[] { "Beginner", "Intermediate", "Advanced", "Expert" });
            form.comboBoxDefaultAI.SelectedIndex = 1;
            
            // AI时间限制
            form.labelAITimeLimit.Location = new Point(20, 50);
            form.labelAITimeLimit.Size = new Size(100, 20);
            form.labelAITimeLimit.Text = "AI思考时间(秒):";
            
            form.numericAITimeLimit.Location = new Point(130, 48);
            form.numericAITimeLimit.Size = new Size(80, 20);
            form.numericAITimeLimit.Minimum = 1;
            form.numericAITimeLimit.Maximum = 30;
            form.numericAITimeLimit.Value = 3;
            
            // AI搜索深度
            form.labelAISearchDepth.Location = new Point(20, 80);
            form.labelAISearchDepth.Size = new Size(100, 20);
            form.labelAISearchDepth.Text = "搜索深度:";
            
            form.numericAISearchDepth.Location = new Point(130, 78);
            form.numericAISearchDepth.Size = new Size(80, 20);
            form.numericAISearchDepth.Minimum = 2;
            form.numericAISearchDepth.Maximum = 8;
            form.numericAISearchDepth.Value = 4;
            
            // 显示AI进度
            form.checkBoxShowAIProgress.Location = new Point(20, 110);
            form.checkBoxShowAIProgress.Size = new Size(150, 20);
            form.checkBoxShowAIProgress.Text = "显示AI思考进度";
            
            // AI策略权重
            form.labelAttackWeight.Location = new Point(20, 140);
            form.labelAttackWeight.Size = new Size(120, 20);
            form.labelAttackWeight.Text = "攻击权重: 1.0";
            
            form.trackBarAttackWeight.Location = new Point(150, 135);
            form.trackBarAttackWeight.Size = new Size(200, 30);
            form.trackBarAttackWeight.Minimum = 5;
            form.trackBarAttackWeight.Maximum = 20;
            form.trackBarAttackWeight.Value = 10;
            form.trackBarAttackWeight.TickFrequency = 1;
            form.trackBarAttackWeight.ValueChanged += form.trackBarAttackWeight_ValueChanged;
            
            form.labelDefenseWeight.Location = new Point(20, 170);
            form.labelDefenseWeight.Size = new Size(120, 20);
            form.labelDefenseWeight.Text = "防守权重: 0.8";
            
            form.trackBarDefenseWeight.Location = new Point(150, 165);
            form.trackBarDefenseWeight.Size = new Size(200, 30);
            form.trackBarDefenseWeight.Minimum = 5;
            form.trackBarDefenseWeight.Maximum = 20;
            form.trackBarDefenseWeight.Value = 8;
            form.trackBarDefenseWeight.TickFrequency = 1;
            form.trackBarDefenseWeight.ValueChanged += form.trackBarDefenseWeight_ValueChanged;
            
            form.labelPositionWeight.Location = new Point(20, 200);
            form.labelPositionWeight.Size = new Size(120, 20);
            form.labelPositionWeight.Text = "位置权重: 0.6";
            
            form.trackBarPositionWeight.Location = new Point(150, 195);
            form.trackBarPositionWeight.Size = new Size(200, 30);
            form.trackBarPositionWeight.Minimum = 5;
            form.trackBarPositionWeight.Maximum = 20;
            form.trackBarPositionWeight.Value = 6;
            form.trackBarPositionWeight.TickFrequency = 1;
            form.trackBarPositionWeight.ValueChanged += form.trackBarPositionWeight_ValueChanged;
        }

        /// <summary>
        /// 初始化界面设置控件
        /// </summary>
        public static void InitializeUISettingsControls(SettingsForm form)
        {
            // 窗口设置
            form.labelWindowSize.Location = new Point(20, 20);
            form.labelWindowSize.Size = new Size(100, 20);
            form.labelWindowSize.Text = "窗口大小:";
            
            form.labelWindowWidth.Location = new Point(20, 50);
            form.labelWindowWidth.Size = new Size(60, 20);
            form.labelWindowWidth.Text = "宽度:";
            
            form.numericWindowWidth.Location = new Point(90, 48);
            form.numericWindowWidth.Size = new Size(80, 20);
            form.numericWindowWidth.Minimum = 600;
            form.numericWindowWidth.Maximum = 1920;
            form.numericWindowWidth.Value = 800;
            
            form.labelWindowHeight.Location = new Point(180, 50);
            form.labelWindowHeight.Size = new Size(60, 20);
            form.labelWindowHeight.Text = "高度:";
            
            form.numericWindowHeight.Location = new Point(250, 48);
            form.numericWindowHeight.Size = new Size(80, 20);
            form.numericWindowHeight.Minimum = 400;
            form.numericWindowHeight.Maximum = 1080;
            form.numericWindowHeight.Value = 600;
            
            form.checkBoxWindowMaximized.Location = new Point(20, 80);
            form.checkBoxWindowMaximized.Size = new Size(150, 20);
            form.checkBoxWindowMaximized.Text = "启动时最大化";
            
            // 颜色设置
            form.labelBoardColor.Location = new Point(20, 110);
            form.labelBoardColor.Size = new Size(100, 20);
            form.labelBoardColor.Text = "棋盘背景:";
            
            form.panelBoardColor.Location = new Point(130, 108);
            form.panelBoardColor.Size = new Size(30, 20);
            form.panelBoardColor.BackColor = Color.FromArgb(222, 184, 135);
            form.panelBoardColor.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonBoardColor.Location = new Point(170, 107);
            form.buttonBoardColor.Size = new Size(60, 22);
            form.buttonBoardColor.Text = "选择";
            form.buttonBoardColor.Click += form.buttonBoardColor_Click;
            
            form.labelLineColor.Location = new Point(20, 140);
            form.labelLineColor.Size = new Size(100, 20);
            form.labelLineColor.Text = "棋盘线条:";
            
            form.panelLineColor.Location = new Point(130, 138);
            form.panelLineColor.Size = new Size(30, 20);
            form.panelLineColor.BackColor = Color.Black;
            form.panelLineColor.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonLineColor.Location = new Point(170, 137);
            form.buttonLineColor.Size = new Size(60, 22);
            form.buttonLineColor.Text = "选择";
            form.buttonLineColor.Click += form.buttonLineColor_Click;
            
            form.labelBlackPiece.Location = new Point(20, 170);
            form.labelBlackPiece.Size = new Size(100, 20);
            form.labelBlackPiece.Text = "黑棋子:";
            
            form.panelBlackPiece.Location = new Point(130, 168);
            form.panelBlackPiece.Size = new Size(30, 20);
            form.panelBlackPiece.BackColor = Color.Black;
            form.panelBlackPiece.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonBlackPieceColor.Location = new Point(170, 167);
            form.buttonBlackPieceColor.Size = new Size(60, 22);
            form.buttonBlackPieceColor.Text = "选择";
            form.buttonBlackPieceColor.Click += form.buttonBlackPieceColor_Click;
            
            form.labelWhitePiece.Location = new Point(20, 200);
            form.labelWhitePiece.Size = new Size(100, 20);
            form.labelWhitePiece.Text = "白棋子:";
            
            form.panelWhitePiece.Location = new Point(130, 198);
            form.panelWhitePiece.Size = new Size(30, 20);
            form.panelWhitePiece.BackColor = Color.White;
            form.panelWhitePiece.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonWhitePieceColor.Location = new Point(170, 197);
            form.buttonWhitePieceColor.Size = new Size(60, 22);
            form.buttonWhitePieceColor.Text = "选择";
            form.buttonWhitePieceColor.Click += form.buttonWhitePieceColor_Click;
            
            form.labelBorderColor.Location = new Point(20, 230);
            form.labelBorderColor.Size = new Size(100, 20);
            form.labelBorderColor.Text = "棋子边框:";
            
            form.panelBorderColor.Location = new Point(130, 228);
            form.panelBorderColor.Size = new Size(30, 20);
            form.panelBorderColor.BackColor = Color.Gray;
            form.panelBorderColor.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonBorderColor.Location = new Point(170, 227);
            form.buttonBorderColor.Size = new Size(60, 22);
            form.buttonBorderColor.Text = "选择";
            form.buttonBorderColor.Click += form.buttonBorderColor_Click;
            
            form.labelLastMoveColor.Location = new Point(20, 260);
            form.labelLastMoveColor.Size = new Size(100, 20);
            form.labelLastMoveColor.Text = "最后落子:";
            
            form.panelLastMoveColor.Location = new Point(130, 258);
            form.panelLastMoveColor.Size = new Size(30, 20);
            form.panelLastMoveColor.BackColor = Color.Red;
            form.panelLastMoveColor.BorderStyle = BorderStyle.FixedSingle;
            
            form.buttonLastMoveColor.Location = new Point(170, 257);
            form.buttonLastMoveColor.Size = new Size(60, 22);
            form.buttonLastMoveColor.Text = "选择";
            form.buttonLastMoveColor.Click += form.buttonLastMoveColor_Click;
            
            // 样式设置
            form.labelPieceStyle.Location = new Point(250, 110);
            form.labelPieceStyle.Size = new Size(100, 20);
            form.labelPieceStyle.Text = "棋子样式:";
            
            form.comboBoxPieceStyle.Location = new Point(360, 108);
            form.comboBoxPieceStyle.Size = new Size(120, 20);
            form.comboBoxPieceStyle.Items.AddRange(new object[] { "圆形", "方形", "菱形" });
            form.comboBoxPieceStyle.SelectedIndex = 0;
            
            form.labelFontSize.Location = new Point(250, 140);
            form.labelFontSize.Size = new Size(100, 20);
            form.labelFontSize.Text = "字体大小:";
            
            form.numericFontSize.Location = new Point(360, 138);
            form.numericFontSize.Size = new Size(80, 20);
            form.numericFontSize.Minimum = 8;
            form.numericFontSize.Maximum = 20;
            form.numericFontSize.Value = 9;
            form.numericFontSize.DecimalPlaces = 1;
            form.numericFontSize.Increment = 0.5m;
            
            form.labelFontName.Location = new Point(250, 170);
            form.labelFontName.Size = new Size(100, 20);
            form.labelFontName.Text = "字体名称:";
            
            form.comboBoxFontName.Location = new Point(360, 168);
            form.comboBoxFontName.Size = new Size(120, 20);
            form.comboBoxFontName.Items.AddRange(new object[] { "微软雅黑", "宋体", "黑体", "Arial", "Times New Roman" });
            form.comboBoxFontName.SelectedIndex = 0;
            
            // 显示选项
            form.checkBoxShowGridLines.Location = new Point(250, 200);
            form.checkBoxShowGridLines.Size = new Size(150, 20);
            form.checkBoxShowGridLines.Text = "显示网格线";
            
            form.checkBoxShowCoordinates.Location = new Point(250, 230);
            form.checkBoxShowCoordinates.Size = new Size(150, 20);
            form.checkBoxShowCoordinates.Text = "显示坐标";
            
            form.checkBoxShowLastMove.Location = new Point(250, 260);
            form.checkBoxShowLastMove.Size = new Size(150, 20);
            form.checkBoxShowLastMove.Text = "显示最后落子";
        }
    }
} 